<template>
<el-dialog title="详情"
           :close-on-click-modal="false" append-to-body
           :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
           width="600px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
    <template v-if="!loading">
            <el-col :span="16"   v-if="jnpf.hasFormP('picturefiles')"

 >
                <jnpf-form-tip-item  label="图片文件"  
 prop="picturefiles"  >
                        <p>{{dataForm.picturefiles}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="6"   v-if="jnpf.hasFormP('picturefilessize')"

 >
                <jnpf-form-tip-item  label="文件大小"  
 prop="picturefilessize"  >
                    <JnpfNumber    v-model="dataForm.picturefilessize_name"
 placeholder="数字文本"  disabled
 :step="1"  controlsPosition="bothSides"  >
                </JnpfNumber>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="16"   v-if="jnpf.hasFormP('videofile')"

 >
                <jnpf-form-tip-item  label="视频文件"  
 prop="videofile"  >
                        <p>{{dataForm.videofile}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="6"   v-if="jnpf.hasFormP('videofilesize')"

 >
                <jnpf-form-tip-item  label="文件大小"  
 prop="videofilesize"  >
                    <JnpfNumber    v-model="dataForm.videofilesize_name"
 placeholder="数字文本"  disabled
 :step="1"  controlsPosition="bothSides"  >
                </JnpfNumber>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="16"   v-if="jnpf.hasFormP('officedocuments')"

 >
                <jnpf-form-tip-item  label="办公文件"  
 prop="officedocuments"  >
                        <p>{{dataForm.officedocuments}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="6"   v-if="jnpf.hasFormP('officedocumentssize')"

 >
                <jnpf-form-tip-item  label="文件大小"  
 prop="officedocumentssize"  >
                    <JnpfNumber    v-model="dataForm.officedocumentssize_name"
 placeholder="数字文本"  disabled
 :step="1"  controlsPosition="bothSides"  >
                </JnpfNumber>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="16"   v-if="jnpf.hasFormP('compressedfile')"

 >
                <jnpf-form-tip-item  label="压缩文件"  
 prop="compressedfile"  >
                        <p>{{dataForm.compressedfile}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="6"   v-if="jnpf.hasFormP('compressedfilesize')"

 >
                <jnpf-form-tip-item  label="文件大小"  
 prop="compressedfilesize"  >
                    <JnpfNumber    v-model="dataForm.compressedfilesize_name"
 placeholder="数字文本"  disabled
 :step="1"  controlsPosition="bothSides"  >
                </JnpfNumber>
                </jnpf-form-tip-item>
            </el-col>
	    <el-col :span="24" >
		<jnpf-form-tip-item  label-width="0">
		<el-alert 
 type="success"  title ="不设置文件大小默认200M" >
		</el-alert>
	</jnpf-form-tip-item>
	</el-col>
    </template>
</el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
    <Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
    </el-dialog>
</template>
<script>
    import request from '@/utils/request'

    import { getConfigData } from '@/api/onlineDev/visualDev'
    import jnpf from '@/utils/jnpf'
    import Detail from '@/views/basic/dynamicModel/list/detail'
    import { thousandsFormat } from "@/components/Generator/utils/index"
    export default {
        components: { Detail},
        props: [],
        data() {
            return {
                visible: false,
                detailVisible: false,
                loading: false,

            dataForm: {
                id :'',
                            picturefiles : [],
                            picturefilessize : 0,
                            videofile : [],
                            videofilesize : 0,
                            officedocuments : [],
                            officedocumentssize : 0,
                            compressedfile : [],
                            compressedfilesize : 0,
            },
                        picturefilesProps:{"label":"fullName","value":"enCode"  },
                        videofileProps:{"label":"fullName","value":"enCode"  },
                        officedocumentsProps:{"label":"fullName","value":"enCode"  },
                        compressedfileProps:{"label":"fullName","value":"enCode"  },

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            toDetail(defaultValue, modelId) {
                if (!defaultValue) return
                getConfigData(modelId).then(res => {
                    if (!res.data || !res.data.formData) return
                    let formData = JSON.parse(res.data.formData)
                    formData.popupType = 'general'
                    this.detailVisible = true
                    this.$nextTick(() => {
                        this.$refs.Detail.init(formData, modelId, defaultValue)
                    })
                })
            },
            dataInfo(dataAll){
                let _dataAll =dataAll
                this.dataForm = _dataAll
            },

            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/MzFileconfiguration/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
